package com.croot.infra.${projectFlag}.rest.api;

import com.croot.infra.common.protocol.PageResult;
import com.croot.infra.${projectFlag}.rest.dto.request.${entityName}IdRestReqDTO;
import com.croot.infra.${projectFlag}.rest.dto.request.${entityName}RestReqDTO;
import com.croot.infra.${projectFlag}.rest.dto.response.${entityName}IdRestRespDTO;
import com.croot.infra.${projectFlag}.rest.dto.response.${entityName}RestRespDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(name = "unified-${appName}-rest-service")
public interface ${entityName}RestAPI {

    @PostMapping("/${projectFlag}/${url}list")
    List<${entityName}RestRespDTO> list${entityName}(@RequestBody @Validated ${entityName}RestReqDTO ${entityParamName}RestReqDTO);

    @PostMapping("/${projectFlag}/${url}add")
    ${entityName}IdRestRespDTO add${entityName}(@RequestBody @Validated ${entityName}RestReqDTO ${entityParamName}RestReqDTO);

    @PostMapping("/${projectFlag}/${url}delete")
    void delete${entityName}(@RequestBody @Validated ${entityName}IdRestReqDTO ${entityParamName}IdRestReqDTO);

    @PostMapping("/${projectFlag}/${url}update")
    void update${entityName}(@RequestBody @Validated ${entityName}RestReqDTO ${entityParamName}RestReqDTO);

    @PostMapping("/${projectFlag}/${url}list-page")
    PageResult<${entityName}RestRespDTO> listPage(@RequestBody @Validated ${entityName}RestReqDTO ${entityParamName});

    @PostMapping("/${projectFlag}/${url}detail")
    ${entityName}RestRespDTO getDetail(@RequestBody @Validated ${entityName}IdRestReqDTO ${entityParamName}IdRestReqDTO);
}
